package com.uoss.applications.modules.foundation.dao.impl;

import org.springframework.stereotype.Repository;
import org.uoss.applications.framework.dao.jpa.AbstractDAO;
import org.uoss.applications.framework.dao.model.QueryModel;
import org.uoss.applications.framework.dao.model.ResultSetModel;
import org.uoss.applications.framework.exception.DAOException;
import org.uoss.core.exception.UOSSException;

import com.uoss.applications.modules.foundation.dao.IAppDAO;
import com.uoss.applications.modules.foundation.entities.TcApp;

@Repository
public class AppDAOImpl extends AbstractDAO<TcApp> implements IAppDAO{

	public void addApp(TcApp app) throws DAOException {
		try {
			this.getGenericDAO().persist(app);
		} 
		catch (UOSSException e) {
			e.printStackTrace();
		}
	}

	public void deleteApp(TcApp app) throws DAOException {
		try {
			this.getGenericDAO().delete(app);
		} 
		catch (UOSSException e) {
			e.printStackTrace();
		}
	}

	public ResultSetModel<TcApp> getAppResultSetByPaging(QueryModel query) throws DAOException {
		ResultSetModel<TcApp> result = null;
		try {
			result = this.getGenericDAO().searchByHQL("from TcApp", query);
		} 
		catch (UOSSException e) {
			e.printStackTrace();
		}
		return result;
	}

	public void updateApp(TcApp app) throws DAOException {
		// TODO Auto-generated method stub
		
	}

}
